<extend name="Org/base"/>
<block name="main">
    <section class="section main">
        <div class="clearfix con-main" id="mainContainer">
            <div class="con-left">
                <div class="panel">
                    <div class="panel-header">
                        <h3 class="panel-title bbs-title">{$bbs.name}</h3>
                    </div>
                    <div class="panel-body">
                        <div class="bbs-info">
                            <a class="photo bbs-photo" href="//bbs.wooo.wang/{$bbs.id}"><img src="//img.wooo.wang/{$bbs.avatar}"></a>
                            <p><strong>{:formatCount($bbs['visit'])}</strong> 浏览 • <strong>{$bbs.gx}</strong> 贡献度</p>
                            <p>{$bbs.desc|default='我好像什么都没写...'}</p>
                            <p class="handle"><if condition="UID"><a id="donationBtn" class="handle-donation" href="javascript:void(0)">打赏</a><else/><a class="handle-donation" href="javascript:alert('您需要先登录账号')">打赏</a></if></p>
                        </div>
                    </div>
                </div>
                <div class="panel" id="siderBox">
                    <ul class="switch-section">
                        <li><a href="{:U('/org/'.$bbs['id'])}"><span class="icon-road"></span> 社区展示</a></li>
                        <li><a href="{:U('/manage/'.$bbs['id'])}"><span class="icon-hammer"></span> 社区管理</a></li>
                        <li><a href="{:U('/review/'.$bbs['id'])}"><span class="icon-eye"></span> 审阅列表</a></li>
                        <li><a href="{:U('/log/'.$bbs['id'])}"><span class="icon-docu"></span> 贡献日志</a></li>
                        <li><a href="{:U('/apply/'.$bbs['id'])}" class="red"><span class="icon-yj"></span> 申请记录</a></li>
                        <if condition="$auth">
                            <li><a href="{:U('/createDoc/'.$bbs['id'])}"><span class="icon-add"></span> 添加文档</a></li>
                            <li><a href="{:U('/set/'.$bbs['id'])}"><span class="icon-setting"></span> 设置社区</a></li>
                        </if>
                    </ul>
                </div>
            </div>
            <div class="con-right">
                <div class="panel other">
                    <div class="panel-header">
                        <h1 class="topic-title">申请记录<span class="icon-sum" id="toggleBtn" onclick="$('#mainContainer').toggleClass('toggle-side-mark');"></span></h1>
                        <p class="topic-info">
                            <a href="//bbs.wooo.wang/{$bbs['id']}">{$bbs['name']}</a> • 展示用户申请与辞职社区管委会主席或理事的请求！
                        </p>
                    </div>
                    <div class="panel-body">
                        <ul class="faq-container" id="applySec">
                            <if condition="$list">
                                <volist name="list" id="v">
                                    <if condition="$v['status'] eq 0">
                                        <li class="faq-div">
                                            <a href="javascript:void(0);" class="faq-count" title="未处理"><span>...</span></a>
                                            <elseif condition="$v['status'] eq 1"/>
                                        <li class="faq-div old">
                                            <a href="javascript:void(0);" class="faq-count" title="已通过"><span class="icon-ok green"></span></a>
                                            <else/>
                                        <li class="faq-div old">
                                            <a href="javascript:void(0);" class="faq-count" title="已拒绝"><span class="icon-no red"></span></a>
                                    </if>
                                    <div class="faq-content">
                                        <h2 class="faq-title"><a href="javascript:void(0)" class="applyTitle" data-aid="{$v.id}"><if condition='$v["type"] eq -1'><span class="art_elite">辞</span><elseif condition='$v["type"] eq 1'/><span class="art_top">申</span><else/><span class="art_top">申超</span></if> {$v.desc}</a></h2>
                                        <p><a href="//wooo.wang/u/{$v['uid']}">{$v.nick}</a>&nbsp;&nbsp;<span class="icon-time"></span> {$v.create|date="Y-m-d",###}</p>
                                        <div class="apply-desc-sec" id="applyHide{$v.id}">
                                            <div class="apply-desc">
                                                <span class="green">内容：</span>{$v.desc}<if condition="$v['status'] neq 0"><span class="green"><br>结果：</span>该申请被管理员<php>echo $v['status'] == 1 ? '<strong class="green">通过</strong>' : '<strong class="red">拒绝</strong>';</php>，并回复：{$v.reply}</if>
                                            </div>
                                            <if condition="$auth and $v['status'] eq 0">
                                                <div class="apply-handle-sec clearfix">
                                                    <textarea spellcheck="false" placeholder="请简单回复..."></textarea>
                                                    <div class="apply-btn-sec" data-aid="{$v.id}">
                                                        <a href="javascript:void(0)" class="btn btn-default applyBtn" data-type="1">通过</a>&nbsp;&nbsp;<a href="javascript:void(0)" class="btn btn-red applyBtn" data-type="-1">拒绝</a>
                                                    </div>
                                                </div>
                                            </if>
                                        </div>
                                    </div>
                                    </li>
                                </volist>
                                <else/>
                                <p class="no-msg">暂无申请记录！</p>
                            </if>
                            {$page}
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </section>
</block>
<block name="js">
    <script>
        $(document).ready(function(){
            var eApplySec = $('#applySec');
            eApplySec.on('click', '.applyTitle', function(){
                var aid = $(this).data('aid');
                $('#applyHide'+aid).toggle();
            });
            eApplySec.on('click', '.applyBtn', function(){
                var elParent = $(this).parent();
                var aid = elParent.data('aid');
                var content = elParent.prev('textarea').val();
                var type = $(this).data('type');
                $.post('/org/dealapply', {
                    'aid': aid,
                    'type': type,
                    'content': content
                }, function(res){
                    var data = $.parseJSON(res);
                    if(data.code == 200){
                        clearpop('处理申请成功', 800);
                        setTimeout(function(){
                            window.location.reload();
                        }, 800);
                    }else{
                        clearpop(data.msg);
                    }
                });
            });
        });
    </script>
    <script src="__STATIC__/doc/js/userMsg.js?v=__VERSION__"></script>
</block>